package com.adcc.msgsimulator.dto;

import com.adcc.msgsimulator.base.BaseConverter;
import com.adcc.msgsimulator.bo.Msg620BO;
import com.adcc.msgsimulator.entity.Msg618DO;
import com.adcc.msgsimulator.entity.Msg620DO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import java.util.List;
import java.util.Map;

@Mapper(componentModel = "spring")
public interface Msg620Converter extends BaseConverter<Msg620BO, Msg620DO> {

    // 实例
    Msg620Converter INSTANCE = Mappers.getMapper(Msg620Converter.class);

    @Mappings({@Mapping(source = "id", target = "id"),
            @Mapping(source = "msgID", target = "msgId"),
            @Mapping(source = "recvTime", target = "timeStamp"),
            @Mapping(source = "depTime", target = "depTime"),
            @Mapping(source = "msgType", target = "msgType"),
            @Mapping(source = "tail", target = "tail"),
            @Mapping(source = "agency", target = "agency"),
            @Mapping(source = "flightNum", target = "fn"),
            @Mapping(source = "label", target = "label"),
            @Mapping(source = "subLabel", target = "subLabel"),
            @Mapping(source = "smi", target = "smi"),
            @Mapping(source = "rgs", target = "rgs"),
            @Mapping(source = "rgsTime", target = "rgsTime"),
            @Mapping(source = "msgLength", target = "msgLength"),
            @Mapping(source = "msg", target = "content")})
    Msg620BO toBO(Msg620DO o);

    @Mappings({@Mapping(source = "id", target = "id"),
            @Mapping(source = "msgId", target = "msgID"),
            @Mapping(source = "timeStamp", target = "recvTime"),
            @Mapping(source = "depTime", target = "depTime"),
            @Mapping(source = "msgType", target = "msgType"),
            @Mapping(source = "tail", target = "tail"),
            @Mapping(source = "agency", target = "agency"),
            @Mapping(source = "fn", target = "flightNum"),
            @Mapping(source = "label", target = "label"),
            @Mapping(source = "subLabel", target = "subLabel"),
            @Mapping(source = "smi", target = "smi"),
            @Mapping(source = "rgs", target = "rgs"),
            @Mapping(source = "rgsTime", target = "rgsTime"),
            @Mapping(source = "msgLength", target = "msgLength"),
            @Mapping(source = "content", target = "msg")})
    Msg620DO toDO(Msg620BO o);

    List<Msg620BO> toBOList(List<Msg620DO> list);

    List<Msg620DO> toDOList(List<Msg620BO> list);
}
